package com.example.service.medical;

import com.example.model.entity.medical.CountHospital;
import com.example.mapper.medical.CountHospitalMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * 预约挂号量医院数据表业务处理
 **/
@Service
public class CountHospitalService {

    @Resource
    private CountHospitalMapper CountHospitalMapper;

    /**
     * 新增
     */
    public void add(CountHospital CountHospital) {
        CountHospitalMapper.insert(CountHospital);
    }

    /**
     * 删除
     */
    public void deleteById(Integer id) {
        CountHospitalMapper.deleteById(id);
    }

    /**
     * 批量删除
     */
    public void deleteBatch(List<Integer> ids) {
        for (Integer id : ids) {
            CountHospitalMapper.deleteById(id);
        }
    }

    /**
     * 修改
     */
    public void updateById(CountHospital CountHospital) {
        CountHospitalMapper.updateById(CountHospital);
    }

    /**
     * 根据ID查询
     */
    public CountHospital selectById(Integer id) {
        return CountHospitalMapper.selectById(id);
    }

    /**
     * 查询所有
     */
    public List<CountHospital> selectAll(CountHospital CountHospital) {
        return CountHospitalMapper.selectAll(CountHospital);
    }

    /**
     * 分页查询
     */
    public PageInfo<CountHospital> selectPage(CountHospital CountHospital, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CountHospital> list = CountHospitalMapper.selectAll(CountHospital);
        return PageInfo.of(list);
    }

}
